<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <title>管理员页面 - 学生信息管理系统</title>
    <style>
        * {
            margin: 0;
            padding: 0;
            box-sizing: border-box;
        }

        body {
            font-family: "Microsoft YaHei", Arial, sans-serif;
            background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
            min-height: 100vh;
            padding: 20px;
        }

        .container {
            max-width: 1200px;
            margin: 0 auto;
            background: white;
            border-radius: 10px;
            box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
            padding: 30px;
        }

        .header {
            display: flex;
            justify-content: space-between;
            align-items: center;
            margin-bottom: 30px;
            padding-bottom: 20px;
            border-bottom: 2px solid #667eea;
        }

        .header h1 {
            color: #333;
            font-size: 28px;
        }

        .user-info {
            display: flex;
            align-items: center;
            gap: 15px;
        }

        .user-badge {
            background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
            color: white;
            padding: 8px 15px;
            border-radius: 20px;
            font-size: 14px;
        }

        .btn {
            display: inline-block;
            padding: 8px 20px;
            background: #667eea;
            color: white;
            text-decoration: none;
            border-radius: 5px;
            transition: background 0.3s;
            border: none;
            cursor: pointer;
            font-size: 14px;
        }

        .btn:hover {
            background: #5568d3;
        }

        .btn-danger {
            background: #e74c3c;
        }

        .btn-danger:hover {
            background: #c0392b;
        }

        .welcome-card {
            background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
            color: white;
            padding: 30px;
            border-radius: 10px;
            margin-bottom: 30px;
        }

        .welcome-card h2 {
            font-size: 24px;
            margin-bottom: 10px;
        }

        .welcome-card p {
            font-size: 16px;
            opacity: 0.9;
        }

        .info-card {
            background: #f8f9fa;
            border-radius: 8px;
            padding: 20px;
            margin-bottom: 20px;
        }

        .info-row {
            display: flex;
            padding: 12px 0;
            border-bottom: 1px solid #e0e0e0;
        }

        .info-row:last-child {
            border-bottom: none;
        }

        .info-label {
            font-weight: bold;
            color: #555;
            width: 150px;
            flex-shrink: 0;
        }

        .info-value {
            color: #333;
            flex: 1;
        }

        .admin-badge {
            background: #f39c12;
            color: white;
            padding: 3px 10px;
            border-radius: 12px;
            font-size: 12px;
            margin-left: 10px;
        }

        .menu-grid {
            display: grid;
            grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
            gap: 20px;
            margin-top: 30px;
        }

        .menu-item {
            background: white;
            border: 2px solid #e0e0e0;
            border-radius: 10px;
            padding: 25px;
            text-align: center;
            transition: all 0.3s;
            text-decoration: none;
            color: #333;
        }

        .menu-item:hover {
            border-color: #667eea;
            transform: translateY(-5px);
            box-shadow: 0 5px 15px rgba(102, 126, 234, 0.3);
        }

        .menu-item h3 {
            color: #667eea;
            margin-bottom: 10px;
            font-size: 20px;
        }

        .menu-item p {
            color: #666;
            font-size: 14px;
        }

        .logout-section {
            margin-top: 30px;
            text-align: center;
            padding-top: 20px;
            border-top: 1px solid #e0e0e0;
        }
    </style>
    <script>
        function logout() {
            if (confirm('确定要退出登录吗？')) {
                window.location.href = '${pageContext.request.contextPath}/logout';
            }
        }
    </script>
</head>
<body>
    <div class="container">
        <div class="header">
            <h1>管理员控制台</h1>
            <div class="user-info">
                <span class="user-badge">
                    管理员：${currentUser.realname}
                </span>
            </div>
        </div>

        <div class="welcome-card">
            <h2>欢迎回来，${currentUser.realname}！</h2>
            <p>您拥有系统最高权限，可以管理所有学生信息和系统设置。</p>
        </div>

        <h3 style="margin-bottom: 15px; color: #333;">个人信息</h3>
        <div class="info-card">
            <div class="info-row">
                <div class="info-label">用户ID：</div>
                <div class="info-value">${currentUser.id}</div>
            </div>
            <div class="info-row">
                <div class="info-label">用户名：</div>
                <div class="info-value">${currentUser.username}</div>
            </div>
            <div class="info-row">
                <div class="info-label">真实姓名：</div>
                <div class="info-value">${currentUser.realname}</div>
            </div>
            <div class="info-row">
                <div class="info-label">邮箱：</div>
                <div class="info-value">${currentUser.email}</div>
            </div>
            <div class="info-row">
                <div class="info-label">角色：</div>
                <div class="info-value">
                    管理员 <span class="admin-badge">ADMIN</span>
                </div>
            </div>
            <div class="info-row">
                <div class="info-label">创建时间：</div>
                <div class="info-value">
                    <fmt:formatDate value="${currentUser.createTime}" pattern="yyyy-MM-dd HH:mm:ss"/>
                </div>
            </div>
        </div>

        <h3 style="margin-bottom: 15px; color: #333; margin-top: 30px;">快捷菜单</h3>
        <div class="menu-grid">
            <a href="${pageContext.request.contextPath}/student?action=list" class="menu-item">
                <h3>📚 学生管理</h3>
                <p>查看、添加、修改、删除学生信息</p>
            </a>
            <a href="${pageContext.request.contextPath}/student?action=add" class="menu-item">
                <h3>➕ 添加学生</h3>
                <p>快速添加新的学生信息</p>
            </a>
            <a href="${pageContext.request.contextPath}/medicine?action=list" class="menu-item">
                <h3>🌿 药材管理</h3>
                <p>查看、添加、修改、删除药材信息</p>
            </a>
            <a href="${pageContext.request.contextPath}/medicine?action=add" class="menu-item">
                <h3>🌱 添加药材</h3>
                <p>快速添加新的药材信息</p>
            </a>
            <a href="#" class="menu-item" onclick="alert('功能开发中...'); return false;">
                <h3>👥 用户管理</h3>
                <p>管理系统用户账号</p>
            </a>
            <a href="#" class="menu-item" onclick="alert('功能开发中...'); return false;">
                <h3>⚙️ 系统设置</h3>
                <p>配置系统参数和选项</p>
            </a>
        </div>

        <div class="logout-section">
            <button onclick="logout()" class="btn btn-danger">退出登录</button>
        </div>
    </div>
</body>
</html>

